package org.ruanjj.designmodel.observemodel;

public class main {
    public static void main(String[] args) {
        IWeatherSubject iWeatherSubject = new weatherSubject();

        PhoneAppObserver phoneAppObserver = new PhoneAppObserver();
        TVAppObserver tvAppObserver = new TVAppObserver();

        //注册设备观察者
        iWeatherSubject.registerObserver(phoneAppObserver);
        iWeatherSubject.registerObserver(tvAppObserver);

        iWeatherSubject.notifyObservers();

        //取消订阅后则不会被通知
        iWeatherSubject.removeObserver(tvAppObserver);
        iWeatherSubject.notifyObservers();
    }
}
